﻿using System;

namespace Aeon.Configuration
{
    /// <summary>
    /// Specifies the type of configuration to view.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    public sealed class DriveConfigurationViewAttribute : Attribute
    {
        /// <summary>
        /// Initializes a new instance of the DriveConfigurationViewAttribute class.
        /// </summary>
        /// <param name="configType">The type of the configuration.</param>
        public DriveConfigurationViewAttribute(Type configType)
        {
            this.configType = configType;
        }
        /// <summary>
        /// Initializes a new instance of the DriveConfigurationViewAttribute class.
        /// </summary>
        /// <param name="configType">The fully qualified name of the type of the configuration.</param>
        public DriveConfigurationViewAttribute(string configTypeName)
        {
            this.configTypeName = configTypeName;
        }

        /// <summary>
        /// Gets the type of the configuration.
        /// </summary>
        public Type ConfigurationType
        {
            get
            {
                return this.configType ?? Type.GetType(this.configTypeName);
            }
        }

        private Type configType;
        private string configTypeName;
    }
}
